import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      // 访问/时，通过路由重定向跳转到欢迎页面
      redirect: '/welcome',
      children: [
        {
          path: '/users',
          name: 'users',
          component: () => import(/* webpackChunkName: "users" */ './views/Users.vue')
        },
        {
          path: '/welcome',
          name: 'welcome',
          component: () => import(/* webpackChunkName: "welcome" */ './views/Welcome.vue')
        },
        {
          path: '/test',
          name: 'test',
          component: () => import(/* webpackChunkName: "test" */ './views/Test.vue')
        },
        {
          path: '/rights',
          name: 'rights',
          component: () => import(/* webpackChunkName: "rights" */ './views/auth/Rights.vue')
        },
        {
          path: '/categories',
          name: 'categories',
          component: () => import(/* webpackChunkName: "categories" */ './views/goods/Cate.vue')
        },
        {
          path: '/goods',
          name: 'goods',
          component: () => import(/* webpackChunkName: "goods" */ './views/goods/Tolise.vue')
        },
        {
          path: '/toadd',
          name: 'toadd',
          component: () => import(/* webpackChunkName: "toadd" */ './views/goods/Toadd.vue')
        },
        {
          path: '/roles',
          name: 'roles',
          component: () => import(/* webpackChunkName: "roles" */ './views/auth/Roles.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import(/* webpackChunkName: "login" */ './views/Login.vue')
    }
  ]
})
